<template>
	<view class="list-pages">
		<view class="top-block">
			<view class="search-block">
				<view class="iconfont icon-a-sousuo1"></view>
				<input placeholder="查询工单" v-model="keyword" class="search" />
			</view>
			<view class="menu-block">
				<view class="menu-item" :class="menuTab==1?'active':''" @click="menuTab=1">
					<view class="menu-name">全部(216)</view>
					<view class="line"></view>
				</view>
				<view class="menu-item" :class="menuTab==2?'active':''" @click="menuTab=2">
					<view class="menu-name">待办(5)</view>
					<view class="line"></view>
				</view>
				<view class="menu-item" :class="menuTab==3?'active':''" @click="menuTab=3">
					<view class="menu-name">已办(211)</view>
					<view class="line"></view>
				</view>
			</view>
		</view>
		<view class="info-block">
			<view class="info-item" v-for="item in list" :key="item.id">
				<view class="text">故障描述</view>
				<view class="content">{{item.content}}</view>
				<view class="form-item">
					<view class="form-text">地址</view>
					<view class="form-content">{{item.address}}</view>
				</view>
				<view class="form-item">
					<view class="form-text">联系人</view>
					<view class="form-content">{{item.name}}</view>
				</view>
				<view class="form-item">
					<view class="form-text">联系电话</view>
					<view class="form-content" style="color: #fb4744;">{{item.phone}}</view>
				</view>
				<view class="form-item">
					<view class="form-text">订单编号</view>
					<view class="form-content">{{item.number}}</view>
				</view>
				<view class="status-item" v-if="item.status==2">
					<view class="status-name" style="color: #ea0000;">待办</view>
					<view class="small-btn normal" @click="navigate('/page_pack/fault/receipt')">回单</view>
				</view>
				<view class="status-item" v-else>
					<view class="status-name" style="color: #46a100;">已办</view>
					<view class="small-btn cancel" @click="navigate('/page_pack/fault/detail')">查看详情</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuTab: 1,
				list: [{
						id: 1,
						content: '故障描述故障描述故障描述故障描述故障描述故障描述故障描述',
						address: '新世纪花园12#4-601',
						name: '王先生',
						phone: '182****5544',
						number: '4c1456444145',
						status: 2
					},
					{
						id: 2,
						content: '故障描述故障描述故障描述故障描述故障描述故障描述故障描述',
						address: '新世纪花园12#4-601',
						name: '王先生',
						phone: '182****5544',
						number: '4c1456444145',
						status: 1
					},
					{
						id: 2,
						content: '故障描述故障描述故障描述故障描述故障描述故障描述故障描述',
						address: '新世纪花园12#4-601',
						name: '王先生',
						phone: '182****5544',
						number: '4c1456444145',
						status: 1
					}
				]
			}
		},
		onLoad(e) {
			if (e.type) {
				this.menuTab = e.type
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list-pages {

		.top-block {
			background: #fb4744;
			padding: 30rpx;

			.search-block {
				width: 100%;
				background-color: #fff;
				height: 80rpx;
				display: flex;
				align-items: center;
				border-radius: 60rpx;
				padding: 0 30rpx;
				margin-bottom: 30rpx;

				.iconfont {
					color: $theme-color;
					font-size: 34rpx;
					width: 50rpx;
				}

				.search {
					width: calc(100% - 50rpx);
				}
			}

			.menu-block {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 30rpx;

				.menu-item.active {
					font-weight: bold;

					.line {
						width: 40rpx;
						height: 14rpx;
						border-radius: 30rpx;
						background-color: #fff;
					}
				}

				.menu-item {
					display: flex;
					align-items: center;
					flex-direction: column;
					color: #fff;
					font-size: 30rpx;

					.menu-name {
						margin-bottom: 20rpx;
					}
				}
			}
		}

		.info-block {
			padding: 30rpx;

			.info-item {
				background-color: #fff;
				padding: 30rpx;
				border-radius: 20rpx;
				margin-bottom: 30rpx;

				.text {
					font-size: 30rpx;
					margin-bottom: 20rpx;
				}

				.content {
					background-color: #f5f6f7;
					padding: 20rpx;
					font-size: 30rpx;
					border-radius: 20rpx;
				}

				.form-item {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 40rpx;
					font-size: 28rpx;
					color: #767676;

					.form-text {
						width: 160rpx;
					}

					.form-content {
						width: calc(100% - 160rpx);
						text-align: end;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}

				.status-item {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 30rpx;
					padding-top: 30rpx;
					border-top: #f5f6f7 1px solid;

					.status-name {
						font-size: 30rpx;
					}

					.small-btn {
						width: 160rpx;
						height: 60rpx;
					}
				}
			}
		}
	}
</style>